<? if((!$detail['startdate']) or ($detail['startdate']=="0000-00-00 00:00:00")) {$detail['startdate']=date("Y-m-d h:i:s");}?>
<? if((!$detail['enddate']) or ($detail['enddate']=="0000-00-00 00:00:00"))  {$detail['enddate']=date("Y-m-d h:i:s");}?>
<? if((!$detail['paydate']) or ($detail['paydate']=="0000-00-00 00:00:00"))  {$detail['paydate']=date("Y-m-d h:i:s");}?>



<br/>





    <fieldset class="layui-elem-field layui-field-title">
        <legend> <i class="fa fa-tasks"></i> 工作人员 </legend>
    </fieldset>












    <div class="work-plane">

    <?
    $employee_list=select_lines_all_items($table_Prefix."employee","status asc,leavedate desc,nid","","0");
    ?>

    <?
    $salesman=select_one_line_all_items($table_Prefix."employee","nid = '".$detail['sales']."'");
    ?>

    <div class="layui-form-item">
        <label class="layui-form-label">业务开发</label>
        <div class="layui-input-block">
            <select name="ai_sales" >
                <option value="<? echo $detail['sales']?>"><? echo $detail['sales']." : ".$salesman['name']?></option>
                <option value="">无</option>
                <? for($i=0;$i<count($employee_list);$i++){ ?>
                    <option value="<? echo $employee_list[$i]['nid'] ?>"><? echo $employee_list[$i]['nid'] ?> : <? echo $employee_list[$i]['name'] ?></option>
                <? } ?>
            </select>

        </div>
        <input type="text"
               name="sales_bonus"
               class="layui-input bonus"
               value="<?echo $bonus_now['sales']?>"
               <?if(!in_array("admin",$quanxian)){echo "disabled";}?>
            >
        <div class="item-tips">
            <label class="layui-form-label"> </label>
            期限超时 <?echo count_days($detail['expect_paydate'],$detail['paydate']); ?> ,
            当前提成点数<?echo $detail['sum']*$bonus_now['sales']."=>".$bonus['sales_bonus']; ?>
        </div>


    </div>


    <?
    $dist_sales=select_one_line_all_items($table_Prefix."employee","nid = '".$detail['dist_sales']."'");
    ?>

    <div class="layui-form-item">
        <label class="layui-form-label">派单业务</label>
        <div class="layui-input-block">
            <select name="ai_dist_sales" >
                <option value="<? echo $detail['dist_sales']?>"><? echo $detail['dist_sales']." : ".$dist_sales['name']?></option>
                <option value="">无</option>
                <? for($i=0;$i<count($employee_list);$i++){ ?>
                    <option value="<? echo $employee_list[$i]['nid'] ?>"><? echo $employee_list[$i]['nid'] ?> : <? echo $employee_list[$i]['name'] ?></option>
                <? } ?>
            </select>
        </div>
        <input type="text" name="sales_bonus"
               class="layui-input bonus"
               value="<?echo $bonus_now['dist_sales']?>"
            <?if(!in_array("admin",$quanxian)){echo "disabled";}?>>

        <div class="item-tips">
            <label class="layui-form-label"> </label>
            期限超时 <?echo count_days($detail['expect_startdate'],$detail['startdate'])+count_days($detail['expect_paydate'],$detail['paydate']) ?> ,
            当前提成点数<?echo $detail['sum']*$bonus_now['dist_sales']."=>".$bonus['dist_sales_bonus']; ?>

        </div>

    </div>


    <?
    $ageant_list=select_lines_all_items($table_Prefix."member","nid desc","","0");
    $agent=select_one_line_all_items($table_Prefix."member","nid = '".$detail['agent']."'");
    ?>

    <div class="layui-form-item">
        <label class="layui-form-label">介绍人</label>
        <div class="layui-input-block">
            <select name="ai_agent" lay-search="" >
                <option value="<? echo $detail['agent']?>"><? echo $detail['agent']." : ".$agent['name']?></option>
                <option value="">无</option>
                <? for($i=0;$i<count($ageant_list);$i++){ ?>
                    <option value="<? echo $ageant_list[$i]['nid'] ?>"><? echo $ageant_list[$i]['nid'] ?> : <? echo $ageant_list[$i]['name'] ?></option>
                <? } ?>
            </select>
        </div>
        <input type="text" name="agent_bonus"
               class="layui-input bonus"
               value="<?echo $bonus_now['agent']?>"
            <?if(!in_array("admin",$quanxian)){echo "disabled";}?>>
    </div>




</div>









<div class="work-plane">


    <?
    $respon=select_one_line_all_items($table_Prefix."employee","nid = '".$detail['respon']."'");
    ?>

    <div class="layui-form-item">
        <label class="layui-form-label">项目负责</label>
        <div class="layui-input-block">
            <select name="ai_respon">
                <option value="<? echo $detail['respon']?>"><? echo $detail['respon']." : ".$respon['name']?></option>
                <option value="">无</option>
                <? for($i=0;$i<count($employee_list);$i++){ ?>
                    <option value="<? echo $employee_list[$i]['nid'] ?>"><? echo $employee_list[$i]['nid'] ?> : <? echo $employee_list[$i]['name'] ?></option>
                <? } ?>
            </select>
        </div>
        <input type="text" name="respon_bonus"
               class="layui-input bonus"
               value="<?echo $bonus_now['respon']?>"
            <?if(!in_array("admin",$quanxian)){echo "disabled";}?>>
    </div>



    <?
    $programer=select_one_line_all_items($table_Prefix."employee","nid = '".$detail['programer']."'");
    ?>


    <div class="layui-form-item">
        <label class="layui-form-label">程序员</label>
        <div class="layui-input-block">
            <select name="ai_programer">
                <option value="<? echo $detail['programer']?>"><? echo $detail['programer']." : ".$programer['name']?></option>
                <option value="">无</option>
                <? for($i=0;$i<count($employee_list);$i++){ ?>
                    <option value="<? echo $employee_list[$i]['nid'] ?>"><? echo $employee_list[$i]['nid'] ?> : <? echo $employee_list[$i]['name'] ?></option>
                <? } ?>
            </select>
        </div>
        <input type="text" name="programer_bonus"   class="layui-input bonus"
               value="<?echo $bonus_now['programer']?>" <?if(!in_array("admin",$quanxian)){echo "disabled";}?>>



            <div class="item-tips">
                <label class="layui-form-label"> </label>
                期限超时 <?echo count_days($detail['expect_enddate'],$detail['enddate']); ?> ,
                当前提成点数<?echo $detail['sum']*$bonus_now['programer']."=>".$bonus['programer_bonus']; ?>

            </div>


    </div>






    <?
    $designer=select_one_line_all_items($table_Prefix."employee","nid = '".$detail['designer']."'");
    ?>


    <div class="layui-form-item">
        <label class="layui-form-label">设计师</label>
        <div class="layui-input-block">
            <select name="ai_designer">
                <option value="<? echo $detail['designer']?>"><? echo $detail['designer']." : ".$designer['name']?></option>
                <option value="">无</option>
                <? for($i=0;$i<count($employee_list);$i++){ ?>
                    <option value="<? echo $employee_list[$i]['nid'] ?>"><? echo $employee_list[$i]['nid'] ?> : <? echo $employee_list[$i]['name'] ?></option>
                <? } ?>
            </select>
        </div>
        <input type="text" name="designer_bonus"   class="layui-input bonus"
               value="<?echo $bonus_now['designer']?>" <?if(!in_array("admin",$quanxian)){echo "disabled";}?>>


            <div class="item-tips">
                <label class="layui-form-label"> </label>
                期限超时 <?echo count_days($detail['expect_enddate'],$detail['enddate']); ?> ,
                当前提成点数<?echo $detail['sum']*$bonus_now['designer']."=>".$bonus['designer_bonus']; ?>

            </div>


    </div>



    <?
    $editor=select_one_line_all_items($table_Prefix."employee","nid = '".$detail['editor']."'");
    ?>


    <div class="layui-form-item">
        <label class="layui-form-label">编辑</label>
        <div class="layui-input-block">
            <select name="ai_editor">
                <option value="<? echo $detail['editor']?>"><? echo $detail['editor']." : ".$editor['name']?></option>
                <option value="">无</option>
                <? for($i=0;$i<count($employee_list);$i++){ ?>
                    <option value="<? echo $employee_list[$i]['nid'] ?>"><? echo $employee_list[$i]['nid'] ?> : <? echo $employee_list[$i]['name'] ?></option>
                <? } ?>
            </select>
        </div>
        <input type="text" name="editor_bonus"   class="layui-input bonus"
               value="<?echo $bonus_now['editor']?>" <?if(!in_array("admin",$quanxian)){echo "disabled";}?>>

        <div class="item-tips">
            <label class="layui-form-label"> </label>
            期限超时 <?echo count_days($detail['expect_enddate'],$detail['enddate']); ?> ,
            当前提成点数<?echo $detail['sum']*$bonus_now['editor']."=>".$bonus['editor_bonus']; ?>
        </div>


    </div>




    <?
    $service=select_one_line_all_items($table_Prefix."employee","nid = '".$detail['service']."'");
    ?>


    <div class="layui-form-item">
        <label class="layui-form-label">跟单</label>
        <div class="layui-input-block">
            <select name="ai_service">
                <option value="<? echo $detail['service']?>"><? echo $detail['service']." : ".$service['name']?></option>
                <option value="">无</option>
                <? for($i=0;$i<count($employee_list);$i++){ ?>
                    <option value="<? echo $employee_list[$i]['nid'] ?>"><? echo $employee_list[$i]['nid'] ?> : <? echo $employee_list[$i]['name'] ?></option>
                <? } ?>
            </select>
        </div>
        <input type="text" name="service_bonus"   class="layui-input bonus"
               value="<?echo $bonus_now['service']?>" <?if(!in_array("admin",$quanxian)){echo "disabled";}?>>


        <div class="item-tips">
            <label class="layui-form-label"> </label>
            期限超时 <?echo count_days($detail['expect_enddate'],$detail['enddate']); ?> ,
            当前提成点数<?echo $detail['sum']*$bonus_now['service']."=>".$bonus['service_bonus']; ?>

        </div>

    </div>




    <?
    $operator=select_one_line_all_items($table_Prefix."employee","nid = '".$detail['operator']."'");
    ?>



        <div class="layui-form-item">
            <label class="layui-form-label">运营</label>
            <div class="layui-input-block">
                <select name="ai_operator">
                    <option value="<? echo $detail['operator']?>"><? echo $detail['operator']." : ".$operator['name']?></option>
                    <option value="">无</option>
                    <? for($i=0;$i<count($employee_list);$i++){ ?>
                        <option value="<? echo $employee_list[$i]['nid'] ?>"><? echo $employee_list[$i]['nid'] ?> : <? echo $employee_list[$i]['name'] ?></option>
                    <? } ?>
                </select>
            </div>
            <input type="text" name="operator_bonus"   class="layui-input bonus"
                   value="<?echo $bonus_now['operator']?>" <?if(!in_array("admin",$quanxian)){echo "disabled";}?>>

            <div class="item-tips">
                <label class="layui-form-label"> </label>
                期限超时 <?echo count_days($detail['expect_enddate'],$detail['enddate']); ?> ,
                当前提成点数<?echo $detail['sum']*$bonus_now['editor']."=>".$bonus['editor_bonus']; ?>
            </div>


        </div>




</div>

<hr class="clearfloat"/>








